package com.wnxy.carl.carlorderassembly.controller;


import com.wnxy.carl.api.OrderInfoApi;
import com.wnxy.carl.carlorderassembly.service.IOrderInfoService;
import com.wnxy.carl.dto.OrderInfoDTO;
import com.wnxy.carl.dto.PageDTO;
import com.wnxy.carl.param.PageParam;
import com.wnxy.carl.param.orderInfo.GenerateOrderInfoParam;
import com.wnxy.carl.response.EPage;
import com.wnxy.carl.response.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 * 订单详情表 前端控制器
 * </p>
 *
 * @author Lucas
 * @since 2021-11-12
 */
@RestController
@RequestMapping("/orderInfo")
@Slf4j
public class OrderInfoController implements OrderInfoApi {

    @Resource
    private IOrderInfoService orderInfoService;

    @Override //生成订单详情 Boolean
    public Result generateOrderInfo(GenerateOrderInfoParam orderInfoParam) {
        log.info("生成订单详情功能：参数= {}",orderInfoParam);
        orderInfoService.generateOrderInfo(orderInfoParam);
        return Result.success("订单详情生成完成");
    }

    @Override //查看订单详情 PageDTO<OrderInfoDTO>
    public Result<? extends EPage<OrderInfoDTO>> seeOrderInof(PageParam<Integer> pageParam) {
        log.info("查看订单详情功能：参数= {}",pageParam);
        PageDTO<OrderInfoDTO> pageDTO = orderInfoService.seeOrderInof(pageParam);

        return Result.success(pageDTO);
    }

}

